#!/usr/bin/env bash

# main.sh

# This file is part of Leah (Language editor and helper).

# Leah is part of Faridayix, an artificially intelligent computer
# operating system.

# Copyright (C) 2010 Scott C. MacCallum
# scottmaccal@gmail.com

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

bold_font="\e[1m"

default_font="\e[0m"

reverse_font="\e[7m"

clear

printf "Hello $USER, Leah speaking."

printf "\n"

printf "\n"

printf "Would you like to edit a file? "

echo -e -n $bold_font

read edit_file

echo -e -n $default_font

  if [[ "$edit_file" == "yes" || "$edit_file" == "y" ]]; then
    edit_file

  elif [[ "$edit_file" == "no" || "$edit_file"  == "n" ]]; then
    printf "\n"

    printf "Would you like to create a new file? "

    echo -e -n $bold_font

    read new_file

    echo -e -n $default_font

      if [[ "$new_file" == "yes" || "$new_file" == "y" ]]; then
        create_new_file
      
      elif [[ "$new_file" == "no" || "$new_file" == "n" ]]; then
        printf "\n"

        printf "Would you like to end our conversation? "
        
        echo -e -n $bold_font

        read end_conversation

        echo -e -n $default_font
      fi
          if [[ "$end_conversation" == "yes" || "$end_conversation" == "y" ]]; then
            exit 0
          
          elif [[ "$end_conversation" == "no" || "$end_conversation" == "n" ]]; then
            leah
          fi
  else
    printf "\n"

    echo -e -n $reverse_font

    echo -e -n $bold_font

    printf "I do not understand what you said."

    echo -e -n $default_font

    printf "\n"

    printf "\n"

    echo -e -n "Please answer me with a ${reverse_font}${bold_font}y${default_font}es or ${reverse_font}${bold_font}n$\
{default_font}o."

    echo -e -n $default_font

    sleep 5

    leah
  fi
#EOF